Lag Compensation

Interpolation

  • Useful for other players .

  • Uses past states to create smooth transitions between positions.

  • Renders the world 50~100ms in the past , to know where the player is and where they will be, interpolating the position between these two points, considering the distance traveled and the time spent.

  • Advantages :

    • Smooth movements without sudden jumps.

  • Disadvantages :

    • Introduces input lag  indirectly, by rendering the world in the past.

  • Use :

    • MOBAs and games where a small delay does not affect gameplay.

  • Impressions :

    • Games relying on mouse clicks can work, but for more tactile inputs like keyboard movement, input lag becomes very noticeable.

  • Implementing Interpolation .

    • The person uses a 20Hz server.

  • <excalidraw_not_loaded>

Strategies for Dealing with Rubberbanding

  • Smooth and Gradual Corrections :

    • Instead of instantly moving the player to the corrected position, the server sends the correction gradually, over a few milliseconds (LERP, Linear Interpolation).

    • If the server detects that the player’s position was incorrect due to prediction, it moves the player smoothly to the correct position over 100-200ms. Transition time depends on the prediction error magnitude.

  • Speed Adjustment :

    • When the player’s position is incorrect, adjust their speed  or movement  to correct the discrepancy instead of repositioning them immediately.

    • If a player predicted a wrong movement, instead of "jumping" to the correct position, they can move slowly until they reach the correct spot.

  • Correction Size Limitation :

    • The server can set limits  for allowed corrections. If the difference between predicted and correct positions is too large, the correction is done more cautiously, or temporarily ignored until the player "approaches" the correct point.

    • If the prediction error is 10 meters, the server might allow only a 3-meter correction at a time instead of teleporting the player all at once.

  • "Less Frequent State Correction" System :

    • The server can correct the player’s state less frequently  or only when the error is significant. This can include a strategy to correct the state periodically  (e.g., every 200ms or 500ms) without trying to correct all prediction errors at once.

    • The server checks and corrects the player’s position only every second, or every 200ms, depending on the perceived error.

Prediction

  • My interpretation :

    • For the player:

      • "The client goes ahead by processing the input locally."

    • For other players:

      • "The client assumes that the other player will maintain the same direction and/or input."

  • Prediction of local input  results before server confirmation.

  • When to use :

    • A way to reduce input lag.

    • When a player performs an action, and the game needs to display it immediately without waiting for the server.

    • Example:

      • You press a key to move → the character moves immediately  on your PC without waiting for the server.

    • The client displays slightly past states to smooth the movement of other  players.

  • Advantages :

    • More fluid and responsive gameplay.

  • Disadvantages :

    • If the server disagrees, it can cause sudden corrections (rubberbanding).

  • Use :

    • FPS, MOBAs, any game requiring fast response.

Extrapolation

  • Prediction of other players/objects  positions when the server does not send new packets.

  • "Sometimes during interpolation, the future frame is not stored due to high lag or packet loss, etc. In this case, Interpolation no longer works."

  • When to use :

    • A form of lag compensation.

    • When there is packet loss or high latency, and the game needs to "guess" where a player is.

    • Example:

      • The game doesn’t receive the next packet about an enemy’s position → assumes they continue in the same direction until new information arrives.

    • If packets are delayed, the game estimates the future position of other  players.

  • Advantages :

    • Prevents freezing or delayed movement display.

  • Disadvantages :

    • If a player does something unexpected, it can cause jumps or sudden corrections.

  • Use :

    • Racing games, sports games, where movement is predictable.

  • Implementing Extrapolation .